/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lesson10;

import java.util.Random;

/**
 *
 * @author netcracker
 */
public class WriterThread extends Thread{

    IVector vector;
    Random random = new Random();

    public WriterThread(IVector vector) {
        this.vector = vector;
    }
    
    @Override
    public void run() {
        write();
    }
    
    private void write(){
        for (int i = 0; i < vector.getLength(); i++) { 
            double d = random.nextDouble();
        vector.set(d, i);
            System.out.println("Write "+d+" to position: "+i);
        }
    }
    
}
